<template>
    <view class="content">
        <view class="bg"></view>
        <view class="wrapper">
            <view class="top" v-if="info.status == 1">
                <image src="../../static/image/us_img_04.png" class="us-img-04"></image>
                <view>待审核</view>
            </view>
            <view class="top" v-if="info.status == 2">
                <image src="../../static/image/us_img_05.png" class="us-img-05"></image>
                <view>培训中</view>
            </view>
            <view class="fail" v-if="info.status == 3">
                <view class="fail-top">
                    <image src="../../static/image/us_img_06.png" class="us-img-06"></image>
                    <view>审核失败</view>
                </view>
                <view class="tip-box">
                    <view class="tip-tit">
                        <image :src="IMAGEURL + 'static/icon/tip.png'" class="tip-icon"></image>
                        <view>审核失败原因说明</view>
                    </view>
                    <view class="tip-text">
                        <u-parse :html="info.reason"></u-parse>
                    </view>
                </view>
            </view>
            <!-- status 0未申请 1待审核 2培训中 3驳回 4通过 -->
            <view class="box">
                <view class="item">
                    <view class="grey">头像</view>
                    <view class="img-box">
                        <image :src="info.service_img" v-if="info.service_img" class="avatar"></image>
                        <image :src="IMAGEURL +  '/static/icon/avatar.png'" v-if="!info.service_img" class="avatar"></image>
                    </view>
                </view>
                
                <view class="item">
                    <view class="grey">姓名</view>
                    <view class="item-right">
                        <input type="text" v-model="info.name" placeholder="请输入姓名" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">性别</view>
                    <view class="item-right">
                        {{info.gender == 1 ? '男' : '女'}}
                    </view>
                </view>
                <view class="item">
                    <view class="grey">年龄</view>
                    <view class="item-right">
                        <input type="number" v-model="info.age" placeholder="请输入年龄" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">出生年月日</view>
                    <view class="item-right">
                        <input type="text" v-model="info.birthday" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
                
                <view class="item">
                    <view class="grey">手机号</view>
                    <view class="item-right">
                        <input type="number" v-model="info.mobile" placeholder="请输入手机号" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">学历</view>
                    <view class="item-right">
                        <input type="text" v-model="info.education" placeholder="请选择" class="inp" disabled>
                        <!-- <u-icon name="arrow-down-fill" color="#535353" size="24" class="u-m-l-10"></u-icon> -->
                    </view>
                </view>
                
                <view class="item">
                    <view class="grey">就读院校</view>
                    <view class="item-right">
                        <input type="text" v-model="info.school" placeholder="请输入毕业院校" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">专业</view>
                    <view class="item-right">
                        <input type="text" v-model="info.speciality" placeholder="请输入专业" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">英语等级</view>
                    <view class="item-right">
                        <input type="text" v-model="info.english" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">现居省市区</view>
                    <view class="adr-box">{{info.current_province}}</view>
                </view>
                <view class="item">
                    <view class="grey">现居地址</view>
                    <view class="item-right u-flex-1">
                        <textarea v-model="info.current_address" maxlength="200" :auto-height="true" placeholder="请输入现居详细地址" class="t-inp2" disabled></textarea>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">身高</view>
                    <view class="item-right">
                        <input type="digit" v-model="info.height" placeholder="请输入身高" class="inp u-p-r-10" disabled>cm
                    </view>
                </view>
                <view class="item">
                    <view class="grey">体重</view>
                    <view class="item-right">
                        <input type="digit" v-model="info.weight" placeholder="请输入体重" class="inp u-p-r-10" disabled>kg
                    </view>
                </view>
                <view class="item">
                    <view class="grey">星座</view>
                    <view class="item-right">
                        <input type="text" v-model="info.star_sign" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
                
                <view class="item">
                    <view class="grey">婚姻状况</view>
                    <view class="item-right">
                        <input type="text" v-model="info.marriage" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">宗教信仰</view>
                    <view class="item-right">
                        <input type="text" v-model="info.belief" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">政治面貌</view>
                    <view class="item-right">
                        <input type="text" v-model="info.politics" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
            </view>
            
            <view class="box">
                <view class="item">
                    <view class="grey">工作经历</view>
                    <view class="item-right">{{ info.is_work == 1 ? '有' : '无' }}</view>
                </view>
            </view>
            <template v-if="info.is_work == 1">
                <view v-for="(item, index) in info.work_history" :key="index">
                    <view class="box">
                        <view class="work-title">工作经历{{index + 1}}</view>
                        <view class="item">
                            <view class="grey">工作时间</view>
                            <view class="item-right u-flex-1">
                                <input type="text" v-model="item.work_date" placeholder="请选择" class="inp" disabled>
                                <!-- <image src="../../static/icon/time_02.png" class="time-02"></image> -->
                            </view>
                        </view>
                        <view class="item">
                            <view class="grey">工作单位</view>
                            <view class="item-right u-flex-1">
                                <input type="digit" v-model="item.work_unit" placeholder="请输入工作单位" class="inp u-p-r-10" disabled>
                            </view>
                        </view>
                        <view class="item">
                            <view class="grey">单位详细地址</view>
                            <view class="item-right u-flex-1">
                                <textarea v-model="item.work_address" maxlength="200" :auto-height="true" placeholder="请输入单位详细地址" class="t-inp2" disabled></textarea>
                            </view>
                        </view>
                        <view class="item">
                            <view class="grey">离职时间</view>
                            <view class="item-right">
                                <input type="text" v-model="item.depart_date" placeholder="请选择" class="inp" disabled>
                                <!-- <image src="../../static/icon/time_02.png" class="time-02"></image> -->
                            </view>
                        </view>
                        <view class="item">
                            <view class="grey">领导名称</view>
                            <view class="item-right">
                                <input type="text" v-model="item.leader" placeholder="请输入领导名称" class="inp u-p-r-10" disabled>
                            </view>
                        </view>
                        <view class="item">
                            <view class="grey">领导电话</view>
                            <view class="item-right">
                                <input type="number" v-model="item.leader_phone" placeholder="请输入领导电话" class="inp u-p-r-10" disabled>
                            </view>
                        </view>
                    </view>
                </view>
            </template>
            
            <view class="box">
                <view class="item">
                    <view class="grey">紧急联系人</view>
                    <view class="item-right">
                        <input type="text" v-model="info.contacts" placeholder="请输入紧急联系人" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">与紧急联系人的关系</view>
                    <view class="item-right">
                        <input type="text" v-model="info.relation" placeholder="请选择" class="inp" disabled>
                    </view>
                </view>
                <view class="item">
                    <view class="grey">紧急联系人电话</view>
                    <view class="item-right">
                        <input type="number" v-model="info.contacts_phone" placeholder="请输入紧急联系人电话" class="inp" disabled>
                    </view>
                </view>
            </view>
            
            <view class="box">
                <view class="item2">
                    <view class="grey">毕业证</view>
                    <view class="img-box">
                        <view class="u-rela" v-for="(item, index) in info.diploma_images" :key="index">
                            <image :src="item.image" class="up-icon2" @click="doPreview(info.diploma_images, index)"></image>
                            <!-- <view class="del-img" v-if="item" @click="delImg(index, 1)">删除</view> -->
                        </view>
                    </view>
                </view>
                <view class="item2">
                    <view class="grey">学位证</view>
                    <view class="img-box">
                        <view class="u-rela" v-for="(item, index) in info.degree_images" :key="index">
                            <image :src="item.image" class="up-icon2" @click="doPreview(info.degree_images, index)"></image>
                            <!-- <view class="del-img" v-if="item" @click="delImg(index, 2)">删除</view> -->
                        </view>
                    </view>
                </view>
                <view class="item2">
                    <view class="grey">资格证书</view>
                    <view class="img-box">
                        <view class="u-rela" v-for="(item, index) in info.skill_images" :key="index">
                            <image :src="item.image" class="up-icon2" @click="doPreview(info.skill_images, index)"></image>
                            <!-- <view class="del-img" v-if="item" @click="delImg(index, 3)">删除</view> -->
                        </view>
                    </view>
                </view>
            </view>
            
            <view class="box">
                <view class="item2">
                    <view class="grey u-p-b-15">爱好及特长</view>
                    <textarea v-model="info.be_good_at" maxlength="40" :auto-height="true" placeholder="请输入爱好及特长" class="t-inp" disabled></textarea>
                    <!-- <view class="words grey2">{{info.be_good_at.length}}/40字</view> -->
                </view>
            </view>
            
            <view class="btn" v-if="info.status == 3" @click="$cTo(`/mine/pages/apply/apply`)">编辑资料</view>
        </view>
    </view>
</template>

<script>
    import { IMAGEURL } from '@/static/js/common.js';
    export default {
        data() {
            return {
                IMAGEURL,
                info: {},
                
            };
        },
        onLoad() {
            this.getInfo()
        },
        methods: {
            //预览照片
            doPreview(data, index) {
                let arr = []
                data.forEach(el => {
                    arr.push(el.image)
                })
                uni.previewImage({
                    urls: arr,
                    current: index,
                    longPressActions: {
                        success: function(data) {
                        },
                        fail: function(err) {
                        }
                    }
                });
            },
            
            getInfo() {
            	this.$ajax('companion_detail', {
            		user_token: this.$getSync('userToken'),
            	}).then(ret => {
            		if (ret.success == 1000) {
                        this.info = ret.detail
            		} else {
            			this.$toast(ret.msg);
            		}
            	});
            },
        }
    };
</script>

<style lang="scss">
    .time-02{
        width: 27rpx;
        height: 28rpx;
        margin-left: 10rpx;
        margin-bottom: 3rpx;
    }
    
    .item2{
        padding: 35rpx 0;
        border-bottom: 2rpx solid #eee;
    }
    .item2:last-child{
        border-bottom: none;
    }
    .work-title{
        font-size: 32rpx;
        font-weight: bold;
        padding-top: 30rpx;
    }
    .words{
        text-align: right;
    }
    .select {
        flex: 1;
    }
    .adr-box {
        flex: 1;
        width: 100%;
        font-size: 28upx;
        text-align: right;
    }
    .adr-box > view {
        width: 100%;
        font-size: 28upx;
        text-align: right;
    }
    .place {
        text-align: right;
        font-size: 28upx;
        color: #888888;
        margin-right: 10upx;
    }
    
    
    .t-inp{
        width: 100%;
        min-height: 100rpx;
        height: auto;
    }
    .t-inp2{
        width: 100%;
        height: auto;
        text-align: right;
    }
    
    .img-box{
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        // padding-top: 15rpx;
    }
    .up-icon2{
        width: 204rpx;
        height: 204rpx;
        margin-right: 12rpx;
        margin-top: 12rpx;
    }
    .up-icon2:nth-child(3n) {
        margin-right: 0;
    }
    .del-img{
        position: absolute;
        right: 12rpx;
        bottom: 0;
        color: #FFFFFF;
        font-size: 22rpx;
        padding: 7rpx 12rpx;
        background-color: #000000;
        opacity: .7;
        border-radius: 5rpx;
    }
    
    page{
        background-color: #f5f5f5;
    }
    .bg {
    	width: 100%;
    	height: 390rpx;
    	position: absolute;
    	top: 0;
    	left: 0;
    	z-index: -1;
    	background: linear-gradient(to bottom, #f29700, #f5f5f5);
    }
    .wrapper{
        padding: 20rpx;
    }
    .fail{
        background-color: #fff;
        border-radius: 15rpx;
        margin-bottom: 20rpx;
        padding: 35rpx;
    }
    .fail-top{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 32rpx;
        padding-bottom: 35rpx;
    }
    .tip-box{
        padding-top: 35rpx;
        border-top: 2rpx solid #eee;
    }
    .tip-tit{
        display: flex;
        justify-content: flex-start;
        align-items: center;
        font-size: 28rpx;
    }
    .tip-icon{
        width: 26rpx;
        height: 26rpx;
        margin-right: 15rpx;
    }
    .tip-text{
        font-size: 24rpx;
        color: #acacac;
        padding-top: 15rpx;
    }
    
    
    
    .top{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 32rpx;
        padding: 35rpx;
        background-color: #fff;
        border-radius: 15rpx;
        margin-bottom: 20rpx;
    }
    .us-img-04{
        width: 210rpx;
        height: 216rpx;
        margin-bottom: 15rpx;
    }
    .us-img-05{
        width: 183rpx;
        height: 222rpx;
        margin-bottom: 15rpx;
    }
    .us-img-06{
        width: 199rpx;
        height: 214rpx;
        margin-bottom: 15rpx;
    }
    .box{
        padding: 0 20rpx;
        background-color: #fff;
        border-radius: 15rpx;
        margin-bottom: 30rpx;
    }
    .item{
        padding: 35rpx 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2rpx solid #eee;
    }
    .item:last-child{
        border-bottom: none;
    }
    .grey{
        color: #000;
    }
    .grey2{
        color: #949494;
    }
    .img-box{
        position: relative;
    }
    .avatar{
        width: 120rpx;
        height: 120rpx;
        border-radius: 50%;
    }
    .up{
        width: 100rpx;
        height: 33rpx;
        background-color: #f6f6f6;
        border-radius: 6rpx;
        font-size: 22rpx;
        color: #9a9a9a;
        text-align: center;
        line-height: 33rpx;
        position: absolute;
        bottom: -10rpx;
        left: 50%;
        transform: translateX(-50%);
    }
    .item-right{
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-left: 15rpx;
    }
    .inp{
        flex: 1;
        text-align: right;
    }
    
    .btn{
        font-size: 34rpx;
        color: #fff;
        text-align: center;
        padding: 25rpx;
        background-color: #f29700;
        border-radius: 10rpx;
        margin: 50rpx 0;
    }

</style>
